﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Users;
using Lists;
using Sim;

namespace Sim
{
    class Program
    {
        static void Main(string[] args)
        {
            DDList dd = new DDList();
            dd.Readfromfile();

            int i = 0;
            Console.WriteLine("Create tournament\n");

            Console.WriteLine("Tournament name: ");
            string tournyname = Console.ReadLine();
            Console.WriteLine("Input date: ");
            DateTime date = DateTime.Today;
            Console.WriteLine("Input height: ");
            int height = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Input gender: ");
            string gender = Console.ReadLine();
            Console.WriteLine("Input max amount of judges: ");
            int maxjudges = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Input max amount of divers: ");
            int maxdivers = Convert.ToInt32(Console.ReadLine());

            Tournament tour1 = new Tournament(tournyname, date, height, gender, maxjudges, maxdivers);

            Console.WriteLine("\nAdd Diver 1\n");

            while (i < maxdivers)
            {
                string name = "";
                string lastname = "";
                int age = 0;
                string nat = "";
                string sex = "";
                string username = "";
                string password = "";

                Console.WriteLine("First name: ");
                name = Console.ReadLine();
                Console.WriteLine("Last name: ");
                lastname = Console.ReadLine();
                Console.WriteLine("Age: ");
                age = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("Nationality: ");
                nat = Console.ReadLine();
                Console.WriteLine("Gender: ");
                sex = Console.ReadLine();
                Console.WriteLine("Username: ");
                username = Console.ReadLine();
                Console.WriteLine("Password: ");
                password = Console.ReadLine();


                UserList.AddUser(new User(name, lastname, age, nat, sex, 0, username, password));
                tour1.listOfDivers.AddDiver(new Diver(name, lastname, age, nat, sex, 0, username, password));

                i++;
                Console.WriteLine("\nAdd Contestant " + (i+1) + "\n");
            }

            i = 0;

            Console.WriteLine("\nAdd Judge 1\n");

            while (i < maxjudges)
            {
                string name = "";
                string lastname = "";
                int age = 0;
                string nat = "";
                string sex = "";
                string username = "";
                string password = "";

                Console.WriteLine("First name: ");
                name = Console.ReadLine();
                Console.WriteLine("Last name: ");
                lastname = Console.ReadLine();
                Console.WriteLine("Age: ");
                age = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("Nationality: ");
                nat = Console.ReadLine();
                Console.WriteLine("Gender: ");
                sex = Console.ReadLine();
                Console.WriteLine("Username: ");
                username = Console.ReadLine();
                Console.WriteLine("Password: ");
                password = Console.ReadLine();


                UserList.AddUser(new User(name, lastname, age, nat, sex, 1, username, password));
                tour1.listOfJudges.AddJudge(new Judge(name, lastname, age, nat, sex, 1, username, password));

                i++;
                Console.WriteLine("\nAdd Judge " + (i + 1) + "\n");
            }

            int rounds = 0;
            int k = 0;
            string jumpcode = "";
            double judgescore = 0;
            

            
            for (rounds = 0; rounds < 6; rounds++)
            {
                Console.WriteLine("Round" + (rounds+1) + "\n");
                for (k = 0; k < maxdivers; k++)
                {
                    Console.WriteLine("Input jumpcode: ");
                    jumpcode = Console.ReadLine();
                    tour1.listOfDivers.diverList[k].dives.Add(new Dive());
                    for (int g = 1; g < maxjudges+1; g++)
                    {
                        Console.WriteLine("Input judgescore " + g + ": ");
                        judgescore = Convert.ToDouble(Console.ReadLine());
                        tour1.listOfDivers.diverList[k].dives[rounds].setJudgeScore(judgescore, g);
                    }
                    tour1.listOfDivers.diverList[k].dives[rounds].CalcPtsnDD(jumpcode, tour1.jumpHeight);
                }
            }



            //tour1.divers._DiverList[0].dives.AddJudge(new Dive("100A"));
            //tour1.divers._DiverList[0].dives[0].setJudgeScore(4.5, 1);
            //tour1.divers._DiverList[0].dives[0].setJudgeScore(3.5, 2);
            //tour1.divers._DiverList[0].dives[0].setJudgeScore(5.0, 3);
            //tour1.divers._DiverList[0].dives[0].setJudgeScore(5.5, 4);
            //tour1.divers._DiverList[0].dives[0].setJudgeScore(7.0, 5);

            //tour1.divers._DiverList[0].dives[0].CalcPtsnDD("100A", tour1.jumpHeight);

            //userList.AddJudge(new User("Van", "Nguyen", 21, "VN", "Male", 0, "vanngh121", "hejhopp123"));
            //userList.AddJudge(new User("Amjad", "Hematkar", 24, "IR", "Male", 0, "amjmah121", "lolol"));
            //userList.AddJudge(new User("Gabriel", "Kasto", 23, "SY", "Male", 0, "gabkah121", "yoyo"));
            //userList.AddJudge(new User("Adam", "Ludenberg", 22, "SE", "Female", 0, "adaluh121", "derp"));

            //userList.AddJudge(new User("Dum1", "Dummare1", 12, "FI", "Male", 1, "jdg1", "jjj"));
            //userList.AddJudge(new User("Dum2", "Dummare2", 12, "UK", "Male", 1, "jdg2", "iii"));
            //userList.AddJudge(new User("Dum3", "Dummare3", 12, "US", "Male", 1, "jdg3", "hhh"));
            //userList.AddJudge(new User("Dum4", "Dummare4", 12, "CN", "Male", 1, "jdg4", "ggg"));
            //userList.AddJudge(new User("Dum5", "Dummare5", 12, "AU", "Male", 1, "jdg5", "fff"));
            //userList.AddJudge(new User("Dum6", "Dummare6", 12, "DK", "Male", 1, "jdg6", "eee"));
            //userList.AddJudge(new User("Dum7", "Dummare7", 12, "NO", "Male", 1, "jdg7", "ddd"));

            //Tourney tour1 = new Tourney("VM14", "6-6-2012", "10M", "Male", 5, 3);

            //tour1.divers.AddJudge(new Diver("Van", "Nguyen", 21, "VN", "Male", 0, "vanngh121", "hejhopp123"));
            //tour1.divers.AddJudge(new Diver("Amjad", "Hematkar", 24, "IR", "Male", 0, "amjmah121", "lolol"));
            //tour1.divers.AddJudge(new Diver("Adam", "Ludenberg", 22, "SE", "Female", 0, "adaluh121", "derp"));
            //tour1.divers.AddJudge(new Diver("Fake", "Faker", 100, "Ponyland", "Shemale", 0, "faker123", "derpiderp"));
            //tour1.divers.AddJudge(new Diver("Fa214124124ke", "F214124aker", 100, "Ponyland", "Shemale", 1, "fa124124ker123", "derpiderp"));
            //tour1.divers.AddJudge(new Diver("Fak21421e", "Fake124124r", 100, "Ponyland", "Shemale", 2, "fake12414r123", "derpiderp"));

            //tour1.judges.AddJudge(new Judge("Dum1", "Dummare1", 12, "FI", "Male", 1, "jdg1", "jjj"));
            //tour1.judges.AddJudge(new Judge("Dum2", "Dummare2", 12, "UK", "Male", 1, "jdg2", "iii"));
            //tour1.judges.AddJudge(new Judge("Dum3", "Dummare3", 12, "US", "Male", 1, "jdg3", "hhh"));
            //tour1.judges.AddJudge(new Judge("Dum4", "Dummare4", 12, "CN", "Male", 1, "jdg4", "ggg"));
            //tour1.judges.AddJudge(new Judge("Dum5", "Dummare5", 12, "AU", "Male", 1, "jdg5", "fff"));
            //tour1.judges.AddJudge(new Judge("Fake", "Faker", 100, "Ponyland", "Shemale", 2, "faker123", "derpiderp"));
            //tour1.judges.AddJudge(new Judge("Faasfke", "Faasfker", 100, "Ponyland", "Shemale", 1, "faasfker123", "deasfarpiderp"));
            //tour1.judges.AddJudge(new Judge("Fake52", "Faker1252", 100, "Ponyland", "Shemale", 4, "faker123452", "derpide125125rp"));

            

            //tour1.divers._DiverList[0].dives.AddJudge(new Dive());
            //tour1.divers._DiverList[0].dives[1].setJudgeScore(4.5, 1);
            //tour1.divers._DiverList[0].dives[1].setJudgeScore(3.5, 2);
            //tour1.divers._DiverList[0].dives[1].setJudgeScore(5.0, 3);
            //tour1.divers._DiverList[0].dives[1].setJudgeScore(5.5, 4);
            //tour1.divers._DiverList[0].dives[1].setJudgeScore(7.0, 5);

            //tour1.divers._DiverList[0].dives[1].CalcPtsnDD("5111C", tour1.jumpHeight);

            //tour1.divers._DiverList[1].dives.AddJudge(new Dive());
            //tour1.divers._DiverList[1].dives[0].setJudgeScore(4.5, 1);
            //tour1.divers._DiverList[1].dives[0].setJudgeScore(3.5, 2);
            //tour1.divers._DiverList[1].dives[0].setJudgeScore(5.0, 3);
            //tour1.divers._DiverList[1].dives[0].setJudgeScore(5.5, 4);
            //tour1.divers._DiverList[1].dives[0].setJudgeScore(7.0, 5);

            //tour1.divers._DiverList[1].dives[0].CalcPtsnDD("6265C", tour1.jumpHeight);

            //tour1.divers._DiverList[1].dives.AddJudge(new Dive());
            //tour1.divers._DiverList[1].dives[1].setJudgeScore(4.5, 1);
            //tour1.divers._DiverList[1].dives[1].setJudgeScore(3.5, 2);
            //tour1.divers._DiverList[1].dives[1].setJudgeScore(5.0, 3);
            //tour1.divers._DiverList[1].dives[1].setJudgeScore(5.5, 4); //Diverlist = contestant, //Dives = contestant current jump
            //tour1.divers._DiverList[1].dives[1].setJudgeScore(7.0, 5);

            //tour1.divers._DiverList[1].dives[1].CalcPtsnDD("6265C", "1M");






            TournamentList.AddTournament(tour1);
            Console.ReadLine();
        }
    }
}
